﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace MapOutput
{
    public partial class Form1 : Form
    {
        private string fileName;
        
        public Form1()
        {
            InitializeComponent();
        }

        private void butOpen_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileOk += new CancelEventHandler(openFileDialog1_FileOk);
            openFileDialog1.ShowDialog();            
        }

        void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            fileName = openFileDialog1.FileName;   
        }

        private void butDeconvert_Click(object sender, EventArgs e)
        {
            Bitmap bitmap = Deconvertor.Deconvert(fileName);            
            pictureBox1.Size = bitmap.Size;            
            this.Width = pictureBox1.Width + butOpen.Width + 100;
            this.Height = pictureBox1.Height + 100;
            //this.Refresh();
            pictureBox1.Image = bitmap;
        }
    }
}
